package com.zhang.crm.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.zhang.crm.constant.Constants;
import com.zhang.crm.mapper.TTranRemarkmapper;
import com.zhang.crm.pojo.TTranRemark;
import com.zhang.crm.pojo.req.TranRemarkReq;
import com.zhang.crm.service.TranRemarkService;
import com.zhang.crm.util.UserUtil;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;

@Service
public class TranRemarkServiceImpl implements TranRemarkService {
    @Resource
    private TTranRemarkmapper tTranRemarkmapper;
    @Override
    @Transactional
    public Boolean addRemark(TranRemarkReq tranRemarkReq) {
        TTranRemark tTranRemark = new TTranRemark();
        BeanUtil.copyProperties(tranRemarkReq,tTranRemark);
        tTranRemark.setCreateBy(UserUtil.getUserInfo().getId());
        tTranRemark.setCreateTime(new Date());
        tTranRemark.setDeleted(0);  //默认正常
        int insert = tTranRemarkmapper.insert(tTranRemark);
        return insert > 0 ? true : false;
    }
}
